<script type="text/javascript"> 
$(document).ready(function () {
      $("#pagination a").each(function(){ 
      this.href = this.href.replace('album/asehoy', 'album/ajax/asehoy');
	  });
      $("#imagelist a").each(function(){ 
      this.href = this.href.replace('sary/asehoy', 'sary/ajax/asehoy');
	  });
	  $("#pagination a").click(function() {
			$("#loading").show();
            var thisHref = $(this).attr("href");
            loadPiece(thisHref,"#imagelist"," #pagination a");
            return false;
        });
	  $("#imagelist a.thumbnail").click(function() {
			$("#loading").show();
            var thisHref = $(this).attr("href");
            loadPiece(thisHref,"#imagelist"," a");
            return false;
        });
		
});

function loadPiece(href,divName,divLink) {    
    $(divName).load(href, {}, function(){
		$("#loading").hide();
        var divPaginationLinks = divName+divLink;
        $(divPaginationLinks).click(function() {     
            var thisHref = $(this).attr("href");
            loadPiece(thisHref,divName,divLink);
            return false;
        });
    });
} 
</script>
<h1><?php echo $title;?></h1>

<?php if($row['username'] == $this->user->username || $this->user->level['album'] >= LEVEL_ADD) : ?>
<div class='adminbox'>
<?php echo anchor('album/sary/ampidiro/' . $row['aid'], __("Add photo", "album")) ?>
 | <?php echo anchor('album/import_flickr/import/' . $row['aid'], __("Import from flickr", "album")) ?>
 <?php if($row['username'] == $this->user->username || $this->user->level['album'] >= LEVEL_EDIT) : ?>
 | <?php echo anchor('album/ampidiro/' . $row['aid'], __("Modify", "album")) ?>
<?php endif; ?>
<?php if($row['username'] == $this->user->username || $this->user->level['album'] >= LEVEL_DEL) : ?>
  | <?php echo anchor('album/fafao/' . $row['aid'], __("Delete", "album")) ?>
<?php endif; ?>

</div>

<?php endif; ?>



		<?php if ($notice = $this->session->flashdata('notification')):?>
		<p class="notice"><?php echo $notice;?></p>
		<?php endif;?>
		
		
<?php if(isset($row['description'])) echo nl2br(strip_tags($row['description'], '<a><b><i>')); ?>

<?php if(isset($row['tags'])) : ?>
<div class="category">
<strong><?php echo __("Tags:", "album") ?> </strong>
<?php $i= 0; foreach($row['tags'] as $tag) :?>
<a href="<?php echo site_url('album/tag/' . $tag['uri']) ?>"><?php echo $tag['tag'] ?></a><?php echo ($i < count($row['tags']) -1 ? ", " : "") ?>
<?php $i++; endforeach; ?>
</div>
<?php endif; ?>


<?php if($sary) : ?>
<div id="imagelist">
<div id="loading" style="visibility: hidden;"><?php __("Loading...", "album") ?></div>
<?php foreach( $sary as $s) : ?>
<a href="<?php echo site_url('album/sary/asehoy/' . $s['sid'])?>" class="thumbnail"><img src="<?php echo $s['s'] ?>"  border="0"/></a>
<?php endforeach;?>
<div id="pagination">
<?php echo $pager ?>
</div>
</div>
<?php else: ?>
<?php echo __("No photo yet", "album") ?>
<?php endif; ?>

